package com.lc.demo.mapper;

import com.lc.demo.bean.Address;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

/**
 * @Author: sakila
 * @Date: 2022/03/07/19:04
 * @Description:
 */
public interface AddressMapper  extends BaseMapper<Address> {


    @Select("select * from t_address where  userId=#{userId}")
    List<Address> selectByUserId(@Param("userId") Integer userId);

    @Update("update  t_address set  isDefault =0 where userId=#{userId}")
    void reloadAddressDefault(@Param("userId") Integer userId);
    @Update("update  t_address set  isDefault =1 where id=#{id}")
    void addressDefault(@Param("id") Integer id);
}
